<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="author" content="火星科技 http://mars3d.cn " />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="x5-fullscreen" content="true" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta
      name="description"
      content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS"
    />

    <link rel="shortcut icon" type="image/x-icon" href="http://mars3d.cn/favicon.ico" />
    <title>外太空物 | Mars3D | 三维地图 | 火星科技 | 合肥火星科技有限公司</title>

    <!--第三方lib-->
    <script
      type="text/javascript"
      src="../lib/include-lib.js"
      libpath="../lib/"
      include="jquery,jquery-range,bootstrap,bootstrap-checkbox,bootstrap-slider,font-awesome,layer,toastr,haoutil,mars3d,mars3d-space"
    ></script>

    <link href="css/style.css" rel="stylesheet" />
    <style>
      /* 滑动轨的样式设置 */
      .slider .tooltip.top {
        margin-top: -45px;
      }
      .slider .tooltip-inner {
        font-size: 18px;
        border: #cde1de 1px solid;
      }
    </style>
  </head>

  <body class="dark">
    <!--加载前进行操作提示，优化用户体验-->
    <div id="mask" class="signmask" onclick="removeMask()"></div>

    <div id="mars3dContainer" class="mars3d-container"></div>

    <!--查询条件面板-->
    <div id="viewContorUi" class="infoview">
      <table class="mars-table">
        <tr>
          <td>系列卫星</td>
          <td>
            <select id="selXilie" class="selectpicker form-control">
              <option value="" selected="selected">无</option>
              <option value="gps">美国 GPS系统</option>
              <option value="bd">中国 北斗卫星系统</option>
              <option value="glonass">俄罗斯 格洛纳斯系统</option>
              <option value="inmarsat">国际海事卫星(Inmarsat)</option>
              <option value="landsat">地球资源卫星(Landsat)</option>
              <option value="digitalglobe">数位全球(DigitalGlobe)</option>
            </select>
          </td>
        </tr>

        <tr>
          <td>所属国家</td>
          <td>
            <select id="selCountry" class="selectpicker form-control">
              <option value="" selected="selected">全部</option>
              <option value="US">美国</option>
              <option value="CIS">俄罗斯</option>
              <option value="PRC">中国</option>
              <option value="UK">英国</option>
              <option value="FR">法国</option>
              <option value="CA">加拿大</option>
              <option value="AUS">澳大利亚</option>
              <option value="JPN">小日本</option>
              <option value="IND">印度</option>
            </select>
          </td>
        </tr>
        <tr>
          <td>对象类型</td>
          <td>
            <select id="selType" class="selectpicker form-control">
              <option value="" selected="selected">全部</option>
              <option value="satellite">普通卫星</option>
              <option value="junk">垃圾(卫星碎片、火箭和助推器)</option>
            </select>
          </td>
        </tr>
        <tr title="雷达截面">
          <td>雷达截面</td>
          <td>
            <input id="slider-rcs" type="text" />
          </td>
        </tr>
        <tr>
          <td>发射日期</td>
          <td>
            <input id="slider-launchdate" type="text" />
          </td>
        </tr>
        <tr>
          <td>轨道周期</td>
          <td>
            <input id="slider-period" type="text" />
          </td>
        </tr>

        <tr>
          <td>轨道类型</td>
          <td>
            <select id="selGuidao" class="selectpicker form-control">
              <option value="" selected="selected">全部</option>
              <option value="low">低地球轨道</option>
              <option value="medium">中地球轨道</option>
              <option value="geosynchronous">地球同步轨道</option>
              <option value="geostationary">地球静止轨道</option>
              <option value="high">高地球轨道</option>
            </select>
          </td>
        </tr>

        <tr>
          <td>倾斜角度</td>
          <td>
            <input id="slider-inclination" type="text" />
          </td>
        </tr>
        <tr>
          <td>远地点高度</td>
          <td>
            <input id="slider-apogee" type="text" />
          </td>
        </tr>
        <tr>
          <td>近地点高度</td>
          <td>
            <input id="slider-perigee" type="text" />
          </td>
        </tr>
        <tr>
          <td></td>
          <td>
            <input id="btnClearQuery" type="button" class="btn btn-primary" value="重置" onclick="resetUI()" />
          </td>
        </tr>
      </table>
    </div>

    <!--卫星详情面板-->
    <div id="pointInfo" class="infoview" style="display: none">
      <input id="btnBack" type="button" class="btn btn-primary" value="返回" onclick="highlightSatellite()" />

      <table class="mars-table tb-border">
        <tr>
          <td class="nametd">名称</td>
          <td id="td_name"></td>
        </tr>
        <tr title="北美空防司令部目录号">
          <td class="nametd">目录号</td>
          <td id="td_norad"></td>
        </tr>
        <tr title="空间研委会编号">
          <td class="nametd">国际代号</td>
          <td id="td_cospar"></td>
        </tr>
        <tr>
          <td class="nametd">对象类型</td>
          <td id="td_type"></td>
        </tr>
        <tr>
          <td class="nametd">操作状态</td>
          <td id="td_status"></td>
        </tr>
        <tr>
          <td class="nametd">所有者/国家</td>
          <td id="td_country"></td>
        </tr>
        <tr>
          <td class="nametd">发射日期</td>
          <td id="td_launchDate"></td>
        </tr>
        <tr>
          <td class="nametd">发射地点</td>
          <td id="td_launchSite"></td>
        </tr>
        <tr id="viewDecay">
          <td class="nametd">衰减日期</td>
          <td id="td_decayDate"></td>
        </tr>
        <tr>
          <td class="nametd">轨道周期[分钟]</td>
          <td id="td_period"></td>
        </tr>
        <tr>
          <td class="nametd">倾角[度]</td>
          <td id="td_inclination"></td>
        </tr>
        <tr>
          <td class="nametd">远地点高度[公里]</td>
          <td id="td_apogee"></td>
        </tr>
        <tr>
          <td class="nametd">近地点高度[公里]</td>
          <td id="td_perigee"></td>
        </tr>
        <tr>
          <td class="nametd">雷达截面</td>
          <td id="td_rcs"></td>
        </tr>
        <tr>
          <td class="nametd">轨道中心</td>
          <td id="td_orbitCenter"></td>
        </tr>
        <tr>
          <td class="nametd">轨道类型</td>
          <td id="td_orbitType"></td>
        </tr>

        <tr>
          <td class="nametd">更多资料</td>
          <td>
            <a id="link_n2yo" href="" class="rc-vertical" target="_blank">N2YO...</a>
          </td>
        </tr>
      </table>
    </div>

    <script src="./js/common.js"></script>
    <script type="text/javascript">
      "use script"; //开发环境建议开启严格模式

      var map;
      var graphicLayer;
      var allCount;

      function initMap(options) {
        //合并属性参数，可覆盖config.json中的对应配置
        var mapOptions = mars3d.Util.merge(options, {
          scene: {
            center: { lat: 29.646563, lng: 96.25028, alt: 150004581, heading: 352, pitch: -90 },
            cameraController: {
              zoomFactor: 3.0,
              minimumZoomDistance: 1,
              maximumZoomDistance: 500000000,
              constrainedAxis: false, //解除在南北极区域鼠标操作限制
            },
            clock: {
              multiplier: 2, //速度
            },
          },
          control: {
            animation: true, //是否创建动画小器件，左下角仪表
            timeline: true, //是否显示时间线控件
          },
        });
        delete mapOptions.terrain;

        //创建三维地球场景
        map = new mars3d.Map("mars3dContainer", mapOptions);

        //修改天空盒
        map.scene.skyBox = new Cesium.SkyBox({
          sources: {
            negativeX: "img/skybox/5/tycho2t3_80_mx.jpg",
            negativeY: "img/skybox/5/tycho2t3_80_my.jpg",
            negativeZ: "img/skybox/5/tycho2t3_80_mz.jpg",
            positiveX: "img/skybox/5/tycho2t3_80_px.jpg",
            positiveY: "img/skybox/5/tycho2t3_80_py.jpg",
            positiveZ: "img/skybox/5/tycho2t3_80_pz.jpg",
          },
        });

        initUI();

        queryTleApiData()
          .then(function (arr) {
            initData(arr);
          })
          .catch(function () {
            haoutil.msg("获取空间目标轨道数据异常！");
          });
      }

      // 访问后端接口，取数据
      function queryTleApiData() {
        return new Promise(function (resolve, reject) {
          $.ajax({
            url: "//data.mars3d.cn/file/apidemo/tle.json",
            type: "get",
            dataType: "json",
            success: function (result) {
              resolve(result.list);
            },
            error: function (data) {
              reject(data);
            },
          });
        });
      }

      function initData(arr) {
        allCount = arr.length;
        haoutil.msg("当前外太空物数量: " + allCount);

        //创建Graphic图层
        graphicLayer = new mars3d.layer.GraphicLayer();
        map.addLayer(graphicLayer);

        //单击地图空白处
        map.on(mars3d.EventType.clickMap, function (event) {
          highlightSatellite();
        });

        graphicLayer.on(mars3d.EventType.click, function (event) {
          console.log("单击了卫星", event);
          //单击事件
          highlightSatellite(event.graphic);
        });

        for (let i = 0; i < arr.length; i++) {
          let item = arr[i];

          let style = {
            pixelSize: 5,
            color: "rgba(0,255,0,0.6)",
            outlineWidth: 1,
            outlineColor: "#000000",
            scaleByDistance: new Cesium.NearFarScalar(20000000, 1.0, 150000000, 0.4),
          };

          //转为属性，方便使用
          if (item.info) {
            item.cospar = item.info[0]; // 国际代号
            item.type = item.info[1]; //对象类型
            item.status = item.info[2]; // 操作状态代码
            item.country = item.info[3]; //所有权(国家)
            item.launchDate = item.info[4] && new Date(item.info[4]); //发射日期
            item.launchSite = item.info[5]; //发射地点
            item.decayDate = item.info[6]; // 衰减日期
            item.period = item.info[7]; // 轨道周期[分钟]
            item.inclination = item.info[8]; //	倾角[度]
            item.apogee = item.info[9]; //远地点高度[公里]
            item.perigee = item.info[10]; //近地点高度[公里]
            item.rcs = item.info[11]; //雷达截面
            // item.dataStatus = item.info[12]; // 数据状态码
            item.orbitCenter = item.info[13]; // 轨道中心
            item.orbitType = item.info[14]; // 轨道类型

            delete item.info;
          }

          var primitive = new mars3d.graphic.PointPrimitive({
            id: item.id,
            style: style,
            attr: item,
          });
          graphicLayer.addGraphic(primitive);
        }

        initWorker(arr);
      }

      //采用多线程来计算卫星位置
      var worker;
      function initWorker(arr) {
        worker = new Worker("./js/tleWorker.js");
        worker.onmessage = function (event) {
          let time = event.data.time;
          let positionObj = event.data.positionObj;
          // console.log('接收到数据', positionObj)

          for (var id in positionObj) {
            let item = positionObj[id];
            if (!item) {
              continue;
            }

            let graphic = graphicLayer.getGraphicById(id);
            if (graphic) {
              graphic.position = new Cesium.Cartesian3(item.x, item.y, item.z);
            }
          }

          //循环继续发送请求消息
          postWorkerMessage(arr);
        };

        //主线程调用worker.postMessage()方法，向 Worker 发消息。
        postWorkerMessage(arr);
      }

      function postWorkerMessage(arr) {
        //取数据的时间范围，开始时间
        let date = Cesium.JulianDate.toDate(map.clock.currentTime);

        //主线程调用worker.postMessage()方法，向 Worker 发消息。
        worker.postMessage({
          time: date,
          list: arr,
        });
      }

      var lastSelectWX;
      function highlightSatellite(satelliteObj) {
        if (lastSelectWX) {
          $("#pointInfo").hide();
          $("#viewContorUi").show();
          //重置上次选中的轨道样式
          lastSelectWX.remove(true);
          lastSelectWX = null;
        }

        if (satelliteObj) {
          let item = satelliteObj.attr;
          showInfo(item);

          //高亮选中的轨道样式
          var weixin = new mars3d.graphic.Satellite({
            tle1: item.tle1,
            tle2: item.tle2,
            model: {
              url: "//data.mars3d.cn/gltf/mars/weixin.gltf",
              scale: 1,
              autoHeading: true,
              minimumPixelSize: 50,
              show: item.name ? true : false,
            },
            label: {
              color: "#ffffff",
              opacity: 1,
              font_family: "楷体",
              font_size: 30,
              outline: true,
              outlineColor: "#000000",
              outlineWidth: 3,
              background: true,
              backgroundColor: "#000000",
              backgroundOpacity: 0.5,
              font_weight: "normal",
              font_style: "normal",
              pixelOffsetX: 0,
              pixelOffsetY: -20,
              scaleByDistance: true,
              scaleByDistance_far: 10000000,
              scaleByDistance_farValue: 0.4,
              scaleByDistance_near: 100000,
              scaleByDistance_nearValue: 1,
              show: true,
            },
            path: {
              show: true,
              color: "#e2e2e2",
              opacity: 0.8,
              width: 1,
            },
          });
          map.graphicLayer.addGraphic(weixin);
          lastSelectWX = weixin;
        }
      }

      function showInfo(attr) {
        if (!attr.name) {
          return;
        }

        $("#pointInfo").show();
        $("#viewContorUi").hide();

        $("#td_name").html(attr.name);
        $("#td_norad").html(attr.id);
        $("#td_cospar").html(attr.cospar);
        $("#td_type").html(attr.type);
        $("#td_status").html(getStatusName(attr.status));
        $("#td_country").html(getCountryName(attr.country));
        if (attr.launchDate) {
          $("#td_launchDate").html(attr.launchDate.format("yyyy-MM-dd"));
        }
        $("#td_launchSite").html(getLaunchSiteName(attr.launchSite));
        if (attr.status == "D") {
          $("#td_decayDate").html(attr.decayDate);
          $("#viewDecay").show();
        } else {
          $("#viewDecay").hide();
        }

        $("#td_period").html(mars3d.Util.formatNum(attr.period, 2) + " 分钟");
        $("#td_inclination").html(attr.inclination + "°");
        $("#td_apogee").html(mars3d.Util.formatNum(attr.apogee, 0) + " km");
        $("#td_perigee").html(mars3d.Util.formatNum(attr.perigee, 0) + " km");
        $("#td_rcs").html(attr.rcs || "未知");
        $("#td_orbitCenter").html(attr.orbitCenter);
        $("#td_orbitType").html(attr.orbitType);

        $("#link_n2yo").attr("href", "https://www.n2yo.com/satellite/?s=" + attr.id);
      }

      // Orbital altitude definitions.
      var LOW_ORBIT = 2000;
      var GEOSYNCHRONOUS_ORBIT = 35786;

      function initUI() {
        $("#selXilie").change(function () {
          selectSatellites();
        });
        $("#selGuidao").change(function () {
          var val = $(this).val();
          switch (val) {
            default:
              $("#slider-apogee").slider("setValue", [
                $("#slider-apogee").slider("getAttribute", "min"),
                $("#slider-apogee").slider("getAttribute", "max"),
              ]);
              $("#slider-perigee").slider("setValue", [
                $("#slider-perigee").slider("getAttribute", "min"),
                $("#slider-perigee").slider("getAttribute", "max"),
              ]);
              $("#slider-inclination").slider("setValue", [
                $("#slider-inclination").slider("getAttribute", "min"),
                $("#slider-inclination").slider("getAttribute", "max"),
              ]);
              break;
            case "low":
              $("#slider-apogee").slider("setValue", [$("#slider-apogee").slider("getAttribute", "min"), LOW_ORBIT]);
              $("#slider-perigee").slider("setValue", [$("#slider-perigee").slider("getAttribute", "min"), LOW_ORBIT]);
              break;
            case "medium":
              $("#slider-apogee").slider("setValue", [LOW_ORBIT, GEOSYNCHRONOUS_ORBIT]);
              $("#slider-perigee").slider("setValue", [LOW_ORBIT, GEOSYNCHRONOUS_ORBIT]);
              break;
            case "geosynchronous":
              $("#slider-apogee").slider("setValue", [GEOSYNCHRONOUS_ORBIT * 0.98, GEOSYNCHRONOUS_ORBIT * 1.02]);
              $("#slider-perigee").slider("setValue", [GEOSYNCHRONOUS_ORBIT * 0.98, GEOSYNCHRONOUS_ORBIT * 1.02]);
              break;
            case "geostationary":
              $("#slider-apogee").slider("setValue", [GEOSYNCHRONOUS_ORBIT * 0.98, GEOSYNCHRONOUS_ORBIT * 1.02]);
              $("#slider-perigee").slider("setValue", [GEOSYNCHRONOUS_ORBIT * 0.98, GEOSYNCHRONOUS_ORBIT * 1.02]);
              $("#slider-inclination").slider("setValue", [0, 1]);
              break;
            case "high":
              $("#slider-apogee").slider("setValue", [GEOSYNCHRONOUS_ORBIT * 1.02, $("#slider-apogee").slider("getAttribute", "max")]);
              $("#slider-perigee").slider("setValue", [GEOSYNCHRONOUS_ORBIT * 1.02, $("#slider-perigee").slider("getAttribute", "max")]);
              break;
          }
          selectSatellites();
        });
        $("#selCountry").change(function () {
          selectSatellites();
        });
        $("#selType").change(function () {
          selectSatellites();
        });

        $("#slider-rcs")
          .slider({
            id: "slider-rcs-internal",
            ticks: [0, 1, 10, 50, 100, 1000],
            ticks_positions: [0, 20, 40, 60, 80, 100],
            ticks_labels: ["0", "1", "10", "50", "100", "1000"],
            range: true,
            value: [0, 1000],
          })
          .on("slideStop", function () {
            selectSatellites();
          });

        $("#slider-launchdate")
          .slider({
            id: "slider-launchdate-internal",
            ticks: [1950, 1960, 1970, 1980, 1990, 2000, 2010, 2021],
            ticks_labels: ["'50", "'60", "'70", "'80", "'90", "'00", "'10", "'20"],
            range: true,
            value: [1950, 2021],
          })
          .on("slideStop", function () {
            selectSatellites();
          });

        $("#slider-period")
          .slider({
            id: "slider-period-internal",
            ticks: [0, 100, 200, 1000, 10000, 60000],
            ticks_positions: [0, 20, 40, 60, 80, 100],
            ticks_labels: ["0", "100", "200", "1k", "1w", "6w"],
            range: true,
            value: [0, 60000],
          })
          .on("slideStop", function () {
            selectSatellites();
          });

        $("#slider-inclination")
          .slider({
            id: "slider-inclination-internal",
            ticks: [0, 30, 60, 90, 120, 150],
            ticks_positions: [0, 20, 40, 60, 80, 100],
            ticks_labels: ["0°", "30°", "60°", "90°", "120°", "150°"],
            range: true,
            value: [0, 150],
          })
          .on("slideStop", function () {
            selectSatellites();
          });

        //远地点高度
        $("#slider-apogee")
          .slider({
            id: "slider-apogee-internal",
            ticks: [0, 1000, 2000, 5000, 10000, 600000],
            ticks_positions: [0, 20, 40, 60, 80, 100],
            ticks_labels: ["0", "1km", "2km", "5km", "10km", "600km"],
            range: true,
            value: [0, 600000],
          })
          .on("slideStop", function () {
            selectSatellites();
          });

        //近地点高度
        $("#slider-perigee")
          .slider({
            id: "slider-perigee-internal",
            ticks: [0, 1000, 2000, 5000, 10000, 500000],
            ticks_positions: [0, 20, 40, 60, 80, 100],
            ticks_labels: ["0", "1km", "2km", "5km", "10km", "500km"],
            range: true,
            value: [0, 500000],
          })
          .on("slideStop", function () {
            selectSatellites();
          });
      }

      function resetUI() {
        if (!graphicLayer) {
          return;
        }

        $("#selXilie").val("");
        $("#selCountry").val("");
        $("#selType").val("");
        $("#selGuidao").val("");

        resetSlider("#slider-rcs");
        resetSlider("#slider-launchdate");
        resetSlider("#slider-period");
        resetSlider("#slider-inclination");
        resetSlider("#slider-apogee");
        resetSlider("#slider-perigee");

        //循环所有卫星
        graphicLayer.eachGraphic(function (graphic) {
          if (graphic.selected) {
            graphic.setStyle({
              color: "rgba(0,255,0,0.6)",
              outlineColor: "#000000",
            });
            graphic.selected = false;
          }
        });
      }

      function resetSlider(name) {
        $(name).slider("setValue", [$(name).slider("getAttribute", "min"), $(name).slider("getAttribute", "max")]);
      }

      // Well known satellite constellations.
      var GPS = [
        // eslint-disable-next-line prettier/prettier
        20959, 22877, 23953, 24876, 25933, 26360, 26407, 26605, 26690, 27663, 27704, 28129, 28190, 28361, 28474, 28874, 29486, 29601, 32260, 32384,
        32711, 35752, 36585, 37753, 38833, 39166, 39533, 39741, 40105, 40294, 40534,
      ];
      var GLONASS = [
        // eslint-disable-next-line prettier/prettier
        28915, 29672, 29670, 29671, 32276, 32275, 32393, 32395, 36111, 36112, 36113, 36400, 36402, 36401, 37139, 37138, 37137, 37829, 37869, 37867,
        37868, 39155, 39620, 40001,
      ];
      var INMARSAT = [20918, 21149, 21814, 21940, 23839, 24307, 24674, 24819, 25153, 28628, 28899, 33278, 40384, 39476];
      var LANDSAT = [25682, 39084];
      var DIGITALGLOBE = [25919, 32060, 33331, 35946, 40115];

      // 判断卫星数据
      function selectSatellites(options = {}) {
        if (!graphicLayer) {
          return;
        }

        var xilie = $("#selXilie").val(); //系列卫星
        var country = $("#selCountry").val(); //所属国家
        var type = $("#selType").val(); //对象类型

        var val1 = $("#slider-launchdate").slider("getValue");
        var val2 = $("#slider-period").slider("getValue");
        var val3 = $("#slider-inclination").slider("getValue");
        var val4 = $("#slider-apogee").slider("getValue");
        var val5 = $("#slider-perigee").slider("getValue");
        var val6 = $("#slider-rcs").slider("getValue");

        var min1 = $("#slider-launchdate").slider("getAttribute", "min");
        var min2 = $("#slider-period").slider("getAttribute", "min");
        var min3 = $("#slider-inclination").slider("getAttribute", "min");
        var min4 = $("#slider-apogee").slider("getAttribute", "min");
        var min5 = $("#slider-perigee").slider("getAttribute", "min");
        var min6 = $("#slider-rcs").slider("getAttribute", "min");

        var max1 = $("#slider-launchdate").slider("getAttribute", "max");
        var max2 = $("#slider-period").slider("getAttribute", "max");
        var max3 = $("#slider-inclination").slider("getAttribute", "max");
        var max4 = $("#slider-apogee").slider("getAttribute", "max");
        var max5 = $("#slider-perigee").slider("getAttribute", "max");
        var max6 = $("#slider-rcs").slider("getAttribute", "max");

        let selCount = 0;

        //循环所有卫星
        graphicLayer.eachGraphic(function (graphic) {
          //先将所有样式还原
          if (graphic.selected) {
            graphic.setStyle({
              color: "rgba(0,255,0,0.6)",
              outlineColor: "#000000",
            });
            graphic.selected = false;
          }

          let attr = graphic.attr; //卫星的属性

          //系列卫星时
          if (xilie) {
            let selected;
            switch (xilie) {
              case "gps":
                selected = GPS.indexOf(attr.id) !== -1;
                break;
              case "bd":
                selected = attr.name.indexOf("BD") !== -1 || attr.name.indexOf("BEIDOU") !== -1;
                break;
              case "glonass":
                selected = GLONASS.indexOf(attr.id) !== -1;
                break;
              case "inmarsat":
                selected = INMARSAT.indexOf(attr.id) !== -1;
                break;
              case "landsat":
                selected = LANDSAT.indexOf(attr.id) !== -1;
                break;
              case "digitalglobe":
                selected = DIGITALGLOBE.indexOf(attr.id) !== -1;
                break;
            }
            if (!selected) {
              return;
            }
          }

          //国家
          if (country && country !== attr.country) {
            return;
          }

          //类型的判断
          if (type) {
            let name = attr.name;
            if (type === "junk" && name.indexOf(" DEB") === -1 && name.indexOf(" R/B") === -1) {
              return;
            }
            if (type === "satellite" && (name.indexOf(" DEB") !== -1 || name.indexOf(" R/B") !== -1)) {
              return;
            }
          }

          // 滑动轨的判断
          // Launch date
          if (val1[0] !== min1 || val1[1] !== max1) {
            if (!attr.launchDate) {
              return;
            }

            var y = attr.launchDate.getFullYear();
            if (y <= val1[0] || y >= val1[1]) {
              return;
            }
          }

          // Orbital period
          if (val2[0] !== min2 || val2[1] !== max2) {
            if (!attr.period) {
              return;
            }
            if (attr.period < val2[0] || attr.period > val2[1]) {
              return;
            }
          }

          // Inclination
          if (val3[0] !== min3 || val3[1] !== max3) {
            if (!attr.inclination) {
              return;
            }
            if (attr.inclination < val3[0] || attr.inclination > val3[1]) {
              return;
            }
          }

          // Apogee
          if (val4[0] !== min4 || val4[1] !== max4) {
            if (!attr.apogee) {
              return;
            }
            if (attr.apogee < val4[0] || attr.apogee > val4[1]) {
              return;
            }
          }

          // Perigee
          if (val5[0] !== min5 || val5[1] !== max5) {
            if (!attr.perigee) {
              return;
            }
            if (attr.perigee < val5[0] || attr.perigee > val5[1]) {
              return;
            }
          }

          // 尺寸的判断
          if (val6[0] !== min6 || val6[1] !== max6) {
            if (!attr.rcs) {
              return;
            }
            if (attr.rcs <= val6[0] || attr.rcs >= val6[1]) {
              return;
            }
          }

          //将筛选到的数据修改为红色
          if (!graphic.selected) {
            graphic.selected = true;
            graphic.setStyle({
              color: "rgba(255,0,0,1.0)",
              outlineColor: "#FFFFFF",
            });
          }
          selCount++;
        });

        haoutil.msg(`${allCount}个对象中，有 ${selCount} 个符合条件`);
      }

      function getStatusName(code) {
        switch (code) {
          case "+":
            return "运作的";
          case "-":
            return "非运转的";
          case "P":
            return "部分运转,部分完成主要任务或次要任务";
          case "B":
            return "备份/备用,先前运行的卫星进入储备状态";
          case "S":
            return "备用,新卫星等待完全激活";
          case "X":
            return "扩展的任务";
          case "D":
            return "衰退的";
          case "?":
            return "未知的";
        }
        return code;
      }

      function getLaunchSiteName(code) {
        switch (code) {
          case "AFETR":
            return "美国佛罗里达州空军东部试验场";
          case "AFWTR":
            return "美国加州空军西部试验场";
          case "CAS":
            return "Canaries Airspace";
          case "DLS":
            return "俄罗斯Dombarovskiy发射场";
          case "ERAS":
            return "东部领空范围";
          case "FRGUI":
            return "法属圭亚那库鲁的欧洲太空港";
          case "HGSTR":
            return "阿尔及利亚的Hammaguira空间轨道靶场";
          case "JSC":
            return "中国酒泉航天中心";
          case "KODAK":
            return "美国阿拉斯加科迪亚克发射中心";
          case "KSCUT":
            return "日本内浦航天中心";
          case "KWAJ":
            return "美国陆军夸贾林环礁";
          case "KYMSC":
            return "俄罗斯Kapustin Yar导弹和太空综合体";
          case "NSC":
            return "韩国罗老宇航中心";
          case "PLMSC":
            return "俄罗斯普列谢茨克导弹和太空综合体";
          case "RLLB":
            return "火箭实验室发射基地";
          case "SEAL":
            return "海上发射平台(流动)";
          case "SEMLS":
            return "伊朗塞姆南卫星发射场";
          case "SMTS":
            return "伊朗沙赫鲁德导弹试验场";
          case "SNMLP":
            return "印度洋(肯尼亚)圣马可发射平台";
          case "SRILR":
            return "印度萨迪什·达万航天中心";
          case "SUBL":
            return "潜艇发射平台(移动式)";
          case "SVOBO":
            return "俄罗斯Svobodnyy发射中心";
          case "TAISC":
            return "中国太原航天中心";
          case "TANSC":
            return "日本种子岛宇宙中心";
          case "TYMSC":
            return "哈萨克斯坦秋拉坦导弹和航天中心";
          case "VOSTO":
            return "俄罗斯东方港航天器发射场";
          case "WLPIS":
            return "美国弗吉尼亚州瓦勒普斯岛";
          case "WOMRA":
            return "澳大利亚Woomera";
          case "WRAS":
            return "西方领空范围";
          case "WSC":
            return "中国文昌卫星发射场";
          case "XICLF":
            return "中国西昌发射场";
          case "YAVNE":
            return "以色列Yavne发射设施";
          case "YUN":
            return "朝鲜云松发射场";
          case "UNK":
            return "未知的";
        }
        return code;
      }

      function getCountryName(code) {
        switch (code) {
          case "AB":
            return "阿拉伯卫星通信组织";
          case "ABS":
            return "亚洲广播卫星";
          case "AC":
            return "亚洲卫星电讯公司";
          case "ALG":
            return "阿尔及利亚";
          case "ANG":
            return "安哥拉";
          case "ARGN":
            return "阿根廷";
          case "ASRA":
            return "奥地利";
          case "AUS":
            return "澳大利亚";
          case "AZER":
            return "阿塞拜疆";
          case "BEL":
            return "比利时";
          case "BELA":
            return "白俄罗斯";
          case "BERM":
            return "百慕大";
          case "BGD":
            return "孟加拉国";
          case "BHUT":
            return "不丹王国";
          case "BOL":
            return "玻利维亚";
          case "BRAZ":
            return "巴西";
          case "BUL":
            return "保加利亚";
          case "CA":
            return "加拿大";
          case "CHBZ":
            return "中国/巴西";
          case "CHLE":
            return "智利";
          case "CIS":
            return "前苏联";
          case "COL":
            return "哥伦比亚";
          case "CRI":
            return "哥斯达黎加共和国";
          case "CZCH":
            return "捷克";
          case "DEN":
            return "丹麦";
          case "ECU":
            return "厄瓜多尔";
          case "EGYP":
            return "埃及";
          case "ESA":
            return "欧洲太空总署";
          case "ESRO":
            return "欧洲空间研究组织";
          case "EST":
            return "爱沙尼亚";
          case "EUME":
            return "欧洲气象卫星开发组织";
          case "EUTE":
            return "欧洲电信卫星组织";
          case "FGER":
            return "法国/德国";
          case "FIN":
            return "芬兰";
          case "FR":
            return "法国";
          case "FRIT":
            return "法国/意大利";
          case "GER":
            return "德国";
          case "GHA":
            return "加纳共和国";
          case "GLOB":
            return "全球星";
          case "GREC":
            return "希腊";
          case "GRSA":
            return "希腊/沙特阿拉伯";
          case "GUAT":
            return "危地马拉";
          case "HUN":
            return "匈牙利";
          case "IM":
            return "国际移动卫星组织(INMARSAT)";
          case "IND":
            return "印度";
          case "INDO":
            return "印尼";
          case "IRAN":
            return "伊朗";
          case "IRAQ":
            return "伊拉克";
          case "IRID":
            return "IRID";
          case "ISRA":
            return "以色列";
          case "ISRO":
            return "印度空间研究组织";
          case "ISS":
            return "国际空间站";
          case "IT":
            return "意大利";
          case "ITSO":
            return "国际电信卫星组织";
          case "JPN":
            return "日本";
          case "KAZ":
            return "哈萨克斯坦";
          case "KEN":
            return "肯尼亚";
          case "LAOS":
            return "老挝";
          case "LKA":
            return "斯里兰卡";
          case "LTU":
            return "立陶宛";
          case "LUXE":
            return "卢森堡";
          case "MA":
            return "摩洛哥";
          case "MALA":
            return "马来西亚";
          case "MEX":
            return "墨西哥";
          case "MMR":
            return "缅甸";
          case "MNG":
            return "蒙古";
          case "MUS":
            return "毛里求斯";
          case "NATO":
            return "北大西洋公约组织";
          case "NETH":
            return "荷兰";
          case "NICO":
            return "新图标";
          case "NIG":
            return "尼日利亚";
          case "NKOR":
            return "朝鲜";
          case "NOR":
            return "挪威";
          case "NPL":
            return "尼泊尔";
          case "NZ":
            return "新西兰";
          case "O3B":
            return "O3b Networks公司";
          case "ORB":
            return "ORBCOMM卫星公司";
          case "PAKI":
            return "巴基斯坦";
          case "PERU":
            return "秘鲁";
          case "POL":
            return "波兰";
          case "POR":
            return "葡萄牙";
          case "PRC":
            return "中国";
          case "PRY":
            return "巴拉圭";
          case "PRES":
            return "中国/欧洲航天局";
          case "QAT":
            return "卡塔尔的状态";
          case "RASC":
            return "非洲区域卫星通信组织";
          case "ROC":
            return "台湾";
          case "ROM":
            return "罗马尼亚";
          case "RP":
            return "菲律宾";
          case "RWA":
            return "卢旺达";
          case "SAFR":
            return "南非";
          case "SAUD":
            return "沙特阿拉伯";
          case "SDN":
            return "苏丹";
          case "SEAL":
            return "Sea Launch公司";
          case "SES":
            return "SES电信公司";
          case "SGJP":
            return "新加坡/日本";
          case "SING":
            return "新加坡";
          case "SKOR":
            return "韩国";
          case "SPN":
            return "西班牙";
          case "STCT":
            return "新加坡/台湾";
          case "SVN":
            return "斯洛文尼亚";
          case "SWED":
            return "瑞典";
          case "SWTZ":
            return "瑞士";
          case "TBD":
            return "待定";
          case "THAI":
            return "泰国";
          case "TMMC":
            return "土库曼斯坦/摩纳哥";
          case "TUN":
            return "突尼斯共和国";
          case "TURK":
            return "土耳其";
          case "UAE":
            return "阿拉伯联合酋长国";
          case "UK":
            return "英国";
          case "UKR":
            return "乌克兰";
          case "URY":
            return "乌拉圭";
          case "US":
            return "美国";
          case "USBZ":
            return "美国/巴西";
          case "VENZ":
            return "委内瑞拉";
          case "VTNM":
            return "越南";
          case "UNK":
            return "未知";
        }
        return code;
      }
    </script>
  </body>
</html>
